package tests;
import java.io.File;
import java.io.IOException;

import org.jfugue.Player;

public class InstrumentChooser {

	public static void main(String[] args) {

		Player player = new Player();
		String musicString = "V0 I89  A4min^w C5majw G4maj^Bw C5majw A4min^w C5majw G4maj^Bw F4maj^^w C5majw A4min^w G4maj^Bw F4maj^^w G4maj^Bw F4maj^^w C5majw A4min^w C5majw A4min^w C5majw A4min^w C5majw A4min^w C5majw G4maj^Bw G4maj^Bw C5majw A4min^w C5majw F4maj^^w F4maj^^w C5majw A4min^w F4maj^^w A4min^w G4maj^Bw A4min^w A4min^w A4min^w G4maj^Bw A4min^w G4maj^Bw A4min^w G4maj^Bw A4min^w C5majw A4min^w A4min^w G4maj^Bw F4maj^^w A4min^w C5majw A4min^w G4maj^Bw C5majw A4min^w G4maj^Bw A4min^w C5majw A4min^w C5majw A4min^w C5majw A4min^w C5majw F4maj^^w G4maj^Bw A4min^w C5majw F4maj^^w A4min^w G4maj^Bw C5majw G4maj^Bw A4min^w C5majw A4min^w G4maj^Bw C5majw A4min^w C5majw V1 I40  C5w C5h D5h C5h E5h C5h C5s C5s D5s E5s C5h A5s A5s C5i C5h D5h C5s C5s G5s A5s D5h C5h G5s E5i E5s C5s A5s E5s D5s D5h C5w C5h D5h C5w C5i G5i E5h C5i* D5i* G5i* G5h C5h D5i* A5i* G5i* C5i C5i A5h C5h D5i C5s D5s C5i G5s E5s D5h C5h E5h C5s A5s C5s C5s D5h C5h G5h C5q E5h C5w C5h E5i G5i C5h D5h C5h E5s E5i G5s C5i* E5i* A5i* G5h C5h D5h C5h C5i D5s A5s C5w C5w C5s D5s D5i A5h C5h E5i A5s G5s C5w C5h G5s D5s E5s D5s C5w C5w C5h G5h C5w C5s C5s A5i D5h C5h C5i C5s E5s C5h E5s C5i C5s C5h G5i* E5i* D5i* C5h E5i* D5i* A5i* C5h D5h C5h C5h C5h D5s E5s G5s A5s C5h A5i C5i C5i* E5i* A5i* E5h C5h E5h C5h C5i C5i C5h A5h C5h A5h C5h D5i D5i C5h A5h C5h C5h C5h E5h C5i* E5i* C5i* D5h C5h E5q C5w C5h D5q C5w C5h A5q C5w C5q C5h C5h D5i G5i C5w C5w C5h D5s D5s C5i C5h C5s D5s A5s E5s C5h A5s G5s A5i C5h E5i E5s D5s C5h D5s G5s G5s G5s C5h A5q C5h A5h C5w C5h G5h C5h E5q C5w C5h E5q C5w C5i E5s G5s C5h C5h G5i* E5i* G5i* C5w C5h G5q C5h D5h C5h G5h C5h A5i* G5i* G5i* C5h C5i E5s G5s C5h G5h";

		try {
			File file = new File("FirstMusic.mid");
			player.saveMidi(musicString, file);
			
			/*
			 * for (int i = 0; i < 128; i++) { String formattedI = formatI(i);
			 * String instrument = "I" + i + " "; File file = new
			 * File("InstrumentChord" + formattedI + ".mid"); String exportMusic
			 * = instrument + musicString; player.saveMidi(exportMusic, file); }
			 */

		} catch (IOException e) {
			e.printStackTrace();
		}

	}

	private static String formatI(int i) {
		String ret = i + "";

		if (i < 10) {
			ret = "00" + ret;
		} else if (i < 100) {
			ret = "0" + ret;
		}

		return ret;
	}

}
